 #Makefile for nbodygpu. No CUDA support by now.
CC=g++ 
CFLAGS=-c -Wall -O3 -fopenmp -lm
LDFLAGS=-lm -fopenmp
SOURCES=common.c parse_config_file.c parse_init_cond.c ffdot.c evolve.c nbody.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=nbodygpu

all: $(SOURCES) $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS) 
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@
	mv $(EXECUTABLE) ../bin/ 
.c.o:
	$(CC) $(CFLAGS) -I../include $< -o $@

makeplummer: plummer_model.o common.o parse_config_file.o
	$(CC) $(LDFLAGS) plummer_model.o parse_config_file.o common.o -o ../bin/makeplummer 

plummer_model.o: plummer_model.c 
	$(CC) -I../include/ -c plummer_model.c $(CFLAGS)

rendersim: render.o common.o parse_config_file.o
	$(CC) -lm -lglut -lGL -lGLU render.o common.o parse_config_file.o -o rendersim
	mv rendersim ../bin
render.o: 
	$(CC) -I../include/ -c render.c $(CFLAGS) -lglut -lGL -lGLU -o render.o 

clean:
	rm *.o

